/*
*   Created by Standard Generator beta version.
*   Created Date Fri Jun 20 13:07:10 GMT+07:00 2003
*/

package com.epro.standard.usermenu;

import java.util.Vector;

import com.epro.standard.infrastructure.root.KeywordElement;
import com.epro.standard.infrastructure.root.StdKeyword;

public class UserMenuKeyword extends StdKeyword {
    public UserMenuKeyword() {
        super();
        addElement("USER_MENU", "UM", "USER_ID", "String", true);
        addElement("USER_MENU", "UM", "MENU_ID", "String", true);
        addElement("USER_MENU", "UM", "ABLE_EXECUTE", "String", true);
        addElement("USER_MENU", "UM", "ABLE_INSERT", "String", true);
        addElement("USER_MENU", "UM", "ABLE_UPDATE", "String", true);
        addElement("USER_MENU", "UM", "ABLE_DELETE", "String", true);
    }

    private void addElement(String tableName, String aliasName, 
                            String columnName, String type, boolean isMain) {
        elements.put(aliasName + "." + columnName, 
                     new KeywordElement(tableName, aliasName, columnName, type, 
                                        isMain));
    }

    public KeywordElement getUM_userID() {
        return (KeywordElement)elements.get("UM.USER_ID");
    }

    public KeywordElement getUM_menuID() {
        return (KeywordElement)elements.get("UM.MENU_ID");
    }

    public KeywordElement getUM_ableExecute() {
        return (KeywordElement)elements.get("UM.ABLE_EXECUTE");
    }

    public KeywordElement getUM_ableInsert() {
        return (KeywordElement)elements.get("UM.ABLE_INSERT");
    }

    public KeywordElement getUM_ableUpdate() {
        return (KeywordElement)elements.get("UM.ABLE_UPDATE");
    }

    public KeywordElement getUM_ableDelete() {
        return (KeywordElement)elements.get("UM.ABLE_DELETE");
    }

    public void setJoin(boolean join, boolean isPKJoin) {
        if (join) {
            isJoin = true;
        } else {
            mainCondition.clearPKCondition();
            isJoin = false;
        }
    }

    public Vector getReturnVO(java.sql.ResultSet rs) {
        Vector returnVector = new Vector();
        try {
            while (rs.next()) {
                returnVector.addElement(new UserMenuVO((isColumnInResultSet("UM_USER_ID", 
                                                                            rs)) ? 
                                                       rs.getString("UM_USER_ID") : 
                                                       null, 
                                                       (isColumnInResultSet("UM_MENU_ID", 
                                                                            rs)) ? 
                                                       rs.getString("UM_MENU_ID") : 
                                                       null, 
                                                       (isColumnInResultSet("UM_ABLE_EXECUTE", 
                                                                            rs)) ? 
                                                       rs.getString("UM_ABLE_EXECUTE") : 
                                                       null, 
                                                       (isColumnInResultSet("UM_ABLE_INSERT", 
                                                                            rs)) ? 
                                                       rs.getString("UM_ABLE_INSERT") : 
                                                       null, 
                                                       (isColumnInResultSet("UM_ABLE_UPDATE", 
                                                                            rs)) ? 
                                                       rs.getString("UM_ABLE_UPDATE") : 
                                                       null, 
                                                       (isColumnInResultSet("UM_ABLE_DELETE", 
                                                                            rs)) ? 
                                                       rs.getString("UM_ABLE_DELETE") : 
                                                       null));
            }
        } catch (java.sql.SQLException sqle) {
            sqle.printStackTrace();
        }
        return returnVector;
    }

    public void addCriteria(KeywordElement ke, String value) {
        addCommonCriteria(ke, value);
    }
}
